﻿@model SingleBlog.Core.SettingModels.SmtpSettingModel
@{
    ViewBag.Title = "SMTP 设置";
}
<ul class="nav nav-pills mb-3">
    <li class="nav-item "><a asp-action="Smtp" class="nav-link active">Smtp 配置</a></li>
    <li class="nav-item "><a asp-action="SmtpTest" class="nav-link">发送测试邮件</a></li>
</ul>
<form method="post">
    @if (ViewContext.ModelState.ErrorCount > 0)
    {
        <div asp-validation-summary="All" class="alert alert-danger"></div>
    }
    else if (TempData["Submit"] != null)
    {
        <div class="alert alert-success">
            <h4><i class="fa fa-check-circle"></i> 保存成功</h4>
        </div>
    }

        <div class="form-group">
            <div class="row">
                <label asp-for="Host" class="col-2 text-right"></label>
                <input class="form-control col-3" asp-for="Host" />
                <div class="col text-muted">例如：smtp.126.com</div>
            </div>
            <div class="row">
                <span asp-validation-for="Host" class="text-danger offset-2"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="row">
                <label asp-for="Port" class="col-2 text-right"></label>
                <input class="form-control col-3" asp-for="Port" />
                <span class="col text-muted">默认25。</span>
            </div>            
            <div class="row">
                <span asp-validation-for="Port" class="text-danger offset-2"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="row">
                <label asp-for="UserName" class="col-2 text-right"></label>
                <input class="form-control col-3" asp-for="UserName" />
                <span class="col text-muted">验证 SMTP 服务器的用户名。</span>
            </div>
            <div class="row">
                <span asp-validation-for="UserName" class="text-danger offset-2"></span>
            </div>
        </div>
        <div class="form-group">
            <div class="row">
                <label asp-for="Password" class="col-2 text-right"></label>
                <input class="form-control col-3" asp-for="Password" />
                <span class="col text-muted">验证 SMTP 服务器的密码。</span>
            </div>
            <div class="row">
                <span asp-validation-for="Password" class="text-danger offset-2"></span>
            </div>
        </div>
    <div class="form-group">
        <div class="row">
            <label asp-for="EnableSSL" class="col-2 text-right">启用 SSL</label>
            <div class="form-check form-check-inline col-3">
                <label class="form-check-label" for="SSL-true">
                    <input class="form-check-input" id="SSL-true" type="radio" asp-for="EnableSSL" value="true" /> 是
                </label>
                &nbsp;
                <label class="form-check-label" for="SSL-false">
                    <input class="form-check-input" id="SSL-false" type="radio" asp-for="EnableSSL" value="false" /> 否
                </label>
            </div>
            <div class="col text-muted">启用 SSL，一般端口为 433。请根据 SMTP 提供商的配置进行设置。</div>
        </div>
    </div>
    <div class="form-group">
        <div class="row">
            <label asp-for="SenderMailAddress" class="col-2 text-right"></label>
            <input class="form-control col-3" asp-for="SenderMailAddress" />
        </div>
        <div class="row">
            <span asp-validation-for="SenderMailAddress" class="text-danger offset-2"></span>
        </div>
    </div>
    <div class="form-group">
        <div class="row">
            <label asp-for="SenderMailName" class="col-2 text-right">发件人显示名称</label>
            <input class="form-control col-3" asp-for="SenderMailName" />
            <span class="col text-muted">发信人的显示名称</span>
        </div>
    </div>
    <div class="form-group">
        <button class="btn btn-primary" type="submit">保 存</button>
    </div>
</form>
@section scripts{ 
    @Html.Partial("/Pages/Shared/_ValidationScripts.cshtml")
}